/*
 * Copyright (c) 2015 Messcat. All rights reserved.
 */
package cc.messcat.common.service;

import cc.messcat.common.model.Pager;

import java.util.List;

public interface BaseService<T> {

	<K> K retrieveObject(Class<K> clazz,Long id);

	T retrieveObject(Long id);

	<K> List<K> retrieveAllObjects(Class<K> clazz);

	List<T> retrieveAllObjects();

	<K> List<K> retrieveByExample(K object);

	void addObject(Object object);

	<K> void modifyObject(K object);

	<K> void removeObject(Class<K> clazz,Long id);

	void removeObject(Long id);

	<K> void removeObject(K object);

	/**
	 * 分页查找
	 * @param pageSize
	 * @param pageNo
	 * @param equalObject
	 * 		精确查找对象
	 * @param likeObject
	 * 		模糊查找对象
	 * @param entityName
	 * 		对象名称
	 * @return
	 */
	Pager<T> retrieveByObject(int pageSize, int pageNo, final Object equalObject, final Object likeObject, String entityName,String orderAttr, String orderType,String orderAttr2, String orderType2);

	<K> K retrieveObjectByState(Class<K> clazz,Long id);

	T retrieveObjectByState(Long id);

	<K> List<K> retrieveAllObjectByState(Class<K> clazz);

	List<T> retrieveAllObjectByState();

	Pager<T> getPager(Integer pageNo, Integer pageSize, List<T> list, Integer rowCount);

	void modifyObjectByCondition(String entityName, final Object updateObject, final Object conditionObject);
	<K> void modifyObject(K object,Long id);
}
